<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    response.setHeader("Cache-Control","no-store"); //HTTP 1.1 
    response.setHeader("Pragma","no-cache"); //HTTP 1.0 
    response.setDateHeader("Expires", 0); //prevents caching at the proxy server

    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Lora Web Framework</title>
<script src="<%=basePath%>/static/js/jquery-1.9.1.min.js"></script>
<script src="<%=basePath%>/static/js/jquery-migrate-1.1.1.js"></script>
<script src="<%=basePath%>/static/js/jquery.md5.js"></script>
<link href="<%=basePath%>/static/css/login.css" rel="stylesheet" type="text/css">
</head>

<body>

    <div id="mainBody">
      <div id="cloud1" class="cloud"></div>
      <div id="cloud2" class="cloud2"></div>
    </div>  
    
    <div class="loginbody">
    
	    <span class="systemlogo"></span> 
	    <div class="loginbox loginbox1">
	    	<form action="">
		    <ul>
			    <li><input name="userName" id="userName" type="text" class="loginuser" value="" /></li>
			    <li><input name="password" id="password" type="password" class="loginpwd" value="" /></li>
			    <li>
			    	<input name="submitButton" id="submitButton" type="button" class="loginbtn" value="登录" />
			    	<label><input name="" type="checkbox" value="" checked="checked" />记住密码</label>
			    </li>
		    </ul>
		    </form>
	    </div>
    
    </div>
</body>


<script language="javascript">

/**************
 * 全局变量
 **************/ 
var mainwidth;
var offset1 = 450;
var offset2 = 0;
var offsetbg = 0;

$(function(){
	
	//位置居中计算
	mainwidth = $("#mainBody").outerWidth();
	$('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
	$(window).resize(function(){  
		$('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
   	});
   	
	//云彩浮动
    setInterval(function() {
        if (offset1 >= mainwidth) {
            offset1 =  -580;
        }
        if (offset2 >= mainwidth) {
			 offset2 =  -580;
        }
        offset1 += 1.2;
		offset2 += 1;
		$("#cloud1").css("background-position", offset1 + "px 100px");
		$("#cloud2").css("background-position", offset2 + "px 460px");
    }, 70);
   	
   	
   	setInterval(function() {
       if (offsetbg >= mainwidth) {
           offsetbg =  -580;
       }

       offsetbg += 0.9;
       $("body").css("background-position", -offsetbg + "px 0");
     }, 90 );
   	
   	//绑定提交按钮动作
   	$('#submitButton').on('click',function(){
   		$('form').attr('action','<%=basePath%>/security/login.do');
   		var passwordValue = $('#password').val();
   		$('#password').val($.md5(passwordValue));
   		$('form').submit();
   	});
   	
   	//绑定回车事件
   	$(document).bind('keydown', function (event) {
		if(event.which == '13' && $("#password").val() != ''){
			$('form').attr('action','<%=basePath%>/security/login.do');
			var passwordValue = $('#password').val();
	   		$('#password').val($.md5(passwordValue));
	   		$('form').submit();
		}
	});
});
  
</script>
</html>